<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="org.lsms.dao.impl.*" %>
<%@ page import="org.lsms.bean.Topic"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>Author Submit Paper Page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="LSMS,ICSEE,AUTHOR">
	
	<link rel="stylesheet" type="text/css" href="../css/author_layout.css">
	<link rel="stylesheet" type="text/css" href="../css/hyper_link_style.css">
	
	<style type="text/css">
	td {
		text-align:center;
	}
	select {
	width:150px;
	}
	</style>
	
	<script type="text/javascript">
	function check(){
		var authorname = document.submit_paper.authorname;
		if(authorname.value==""){
			alert("Please input author(s) name!");
			authorname.focus();
			return false;
		}
		
		var email = document.submit_paper.email;
		if(email.value==""){
			alert("Please input the e_mail address!");
			email.focus();
			return false;
		}
		
		var tel = document.submit_paper.tel;
		if(tel.value==""){
			alert("Please inpute the phone number!");
			tel.focus();
			return false;
		}
		
		var topic1 = document.submit_paper.topic1;
		if(topic1.value==""){
			alert("Please select the first topic for your paper!");
			topic1.focus();
			return false;
		}
		
		var topic2 = document.submit_paper.topic2;
		if(topic2.value==""){
			alert("Please select the second topic for your paper!");
			topic2.focus();
			return false;
		}
		
		var title = document.submit_paper.title;
		if(title.value==""){
			alert("Please input the title of your paper!");
			title.focus();
			return false;
		}
		
		var abstract = document.submit_paper.abstract;
		if(abstract==""){
			alert("Please input the abstract of your paper!");
			abstract.focus();
			return false;
		}
		
		var keywords = document.submit_paper.keywords;
		if(keywords==""){
			alert("Please input the abstract of your paper!");
			keywords.focus();
			return false;
		}
		
		return true;
	}
	</script>
	
  </head>
  
  <body>
	<div id="container">
		<div id="header" class="logo_image"></div>
		<div class="nav"></div>
		<div id="author_menu" class="border">
			<table border="0" width="100%"  >
				<tr>
					<td  bgcolor="#CCCCCC"><a href="../index.jsp">Home</a></td>
				</tr>
				<tr>
					<td  bgcolor="#CCCCCC"><a href="submit_paper.jsp">Submit Paper</a></td>
				</tr>
				<tr>
					<td  bgcolor="#CCCCCC"><a href="paper_history.jsp">History / Paper Status</a></td>
				</tr>
				<tr>
					<td  bgcolor="#CCCCCC"><a href="register_info.jsp">Register Information</a></td>
				</tr>
				<tr>
					<td  bgcolor="#CCCCCC"><a href="modify_info.jsp">Modify Information</a></td>
				</tr>
				<tr>
					<td  bgcolor="#CCCCCC"><a href="../logout">Log Out</a></td>
				</tr>
			</table>
		</div>
		
		<div id="content" class="bg_color border">
			<div style="margin:15px;">
			<h5>Paper Submit</h5>
			<form action="../paper_submit" method="post" name="submit_paper" enctype="multipart/form-data" onSubmit="return check()">
				<table align="center" border="0">
				<tr>
					<td colspan="2" style="text-align:left;"><b>Personal Information</b></td>
				</tr>
				<tr>
					<td>
					<br>
					</td>
				</tr>
				<tr>
					<td><b>Author(s) Name</b></td>
					<td>
						<input type="text" name="authorname" size="50">
					</td>
				</tr>
				<tr>
					<td><b>Email</b></td>
					<td>
						<input type="text" name="email" size="50">
					</td>
				</tr>
				<tr>
					<td><b>Tel</b></td>
					<td>
						<input type="text" name="tel" size="50">
					</td>
				</tr>
				<tr>
					<td>
					<br>
					</td>
				</tr>
				<tr>
					<td colspan="2">
					<hr>
					</td>
				</tr>
				<tr>
					<td>
					<br>
					</td>
				</tr>
				<tr>
					<td colspan="2" style="text-align:left;" >
					<b>Paper Information</b>
					</td>
				</tr>
				<tr>
					<td>
					<b>Topic 1</b>
					</td>
					<td style="text-align:left">
					<select name="topic1">
						<option value="" selected>----Please Choose----</option>
					<%
						DaoImpl impl = new DaoImpl();
						HashMap<String,List<Topic>> map = impl.get_all_topic();
						List<Topic> list = map.get("all");
						String key = "";
						for(int i=0;i<list.size();i++){
							Topic topic = list.get(i);
							key = topic.getTopicname();
							out.write("<option value=\"");
							out.print(key);
							out.write("\">");
							out.print(topic.getTopiccontent());
							out.write("</option>");
						}
					%>		
					</select>
					</td>
				</tr>
				<tr>
					<td>
					<b>Topic 2</b>
					</td>
					<td style="text-align:left">
					<select name="topic2">
						<option value="" selected>----Please Choose----</option>
					<%
						HashMap<String,List<Topic>> map2 = impl.get_all_topic();
						List<Topic> list2 = map.get("all");
						String key2 = "";
						for(int i=0;i<list2.size();i++){
							Topic topic = list2.get(i);
							key2 = topic.getTopicname();
							out.write("<option value=\"");
							out.print(key2);
							out.write("\">");
							out.print(topic.getTopiccontent());
							out.write("</option>");
						}
					%>	
					</select>
					</td>
				</tr>
				<tr>
					<td>
					<b>Title</b>
					</td>
					<td>
					<input type="text" name="title" size="50">
					</td>
				</tr>
				<tr>
					<td>
					<b>Abstract</b>
					</td>
					<td style="text-align:left">
					<textarea name="abstract" rows="3" cols="30"></textarea>
					</td>
				</tr>
				<tr>
					<td>
					<b>KeyWords</b>
					</td>
					<td>
					<input type="text" name="keywords" size="50">
					</td>
				</tr>
				<tr>
					<td>
					<b>Paper</b>
					</td>
					<td style="text-align:left">
					<input type="file" name="paper">
					<input type="submit" value="Submit" name="submit">
					</td>
				</tr>
				</table>
			</form>
			</div>
			
		</div>
		
		<div class="nav"></div>
			
		<div id="footer" class="footer_color border">
			<p align="center"><b>&copy;2010 LSMS-All Rights Reserved.</b></p>
			<p align="center"> <b>Powered by Shu.</b></p>
		</div>
	</div>
  </body>
</html>
